cmake_minimum_required(VERSION 3.22.1)

project("play")

#引入include目录
include_directories(
    ${CMAKE_SOURCE_DIR}/agent
    ${CMAKE_SOURCE_DIR}/base
    ${CMAKE_SOURCE_DIR}/media
    ${CMAKE_SOURCE_DIR}/media/capture
    ${CMAKE_SOURCE_DIR}/media/channel
    ${CMAKE_SOURCE_DIR}/media/codec
    ${CMAKE_SOURCE_DIR}/media/device
    ${CMAKE_SOURCE_DIR}/media/render
    ${CMAKE_SOURCE_DIR}/third_party/include
    ${CMAKE_SOURCE_DIR}/third_wrapper
)

#源文件
file(GLOB src_list
    ${CMAKE_SOURCE_DIR}/agent/*.cpp
    ${CMAKE_SOURCE_DIR}/agent/android/*.cpp
    ${CMAKE_SOURCE_DIR}/base/*.cpp
    ${CMAKE_SOURCE_DIR}/base/concurrent/*.cpp
    ${CMAKE_SOURCE_DIR}/base/queue/*.cpp
    ${CMAKE_SOURCE_DIR}/base/utils/*.cpp
    ${CMAKE_SOURCE_DIR}/media/*.cpp
    ${CMAKE_SOURCE_DIR}/media/capture/*.cpp
    ${CMAKE_SOURCE_DIR}/media/capture/android/*.cpp
    ${CMAKE_SOURCE_DIR}/media/channel/*.cpp
    ${CMAKE_SOURCE_DIR}/media/codec/*.cpp
    ${CMAKE_SOURCE_DIR}/media/codec/decoder/*.cpp
    ${CMAKE_SOURCE_DIR}/media/codec/encoder/*.cpp
    ${CMAKE_SOURCE_DIR}/media/device/*.cpp
    ${CMAKE_SOURCE_DIR}/media/render/*.cpp
    ${CMAKE_SOURCE_DIR}/media/render/android/*.cpp
    ${CMAKE_SOURCE_DIR}/third_wrapper/*.cpp
    )


#引入外部库的搜索路径
link_directories(
    ${CMAKE_SOURCE_DIR}/third_party/libs/${CMAKE_ANDROID_ARCH_ABI}
)

add_library(
    ${PROJECT_NAME}
    SHARED
    ${src_list})

#系统库
set(sys_lib log
    EGL
    GLESv3
    OpenSLES
    android
    z
    )

#第三方库
set(third_lib
    fdk-aac
    x264
    rtmp
    avfilter
    avformat
    avcodec
    avutil
    swresample
    swscale
    yuv
    )

target_link_libraries(${PROJECT_NAME} ${sys_lib} ${third_lib})

#测试程序
add_subdirectory(exec_file)
